class Solution
{
public:
    vector<vector<int>> mergeArrays(vector<vector<int>> &nums1, vector<vector<int>> &nums2)
    {
        map<int, int> m;
        for (auto &num1 : nums1)
        {
            m[num1[0]] = num1[1];
        }
        for (auto &num2 : nums2)
        {
            m[num2[0]] += num2[1];
        }
        vector<vector<int>> result;
        for (auto &[id, num] : m)
        {
            result.push_back({id, num});
        }
        return result;
    }
};